matcha = [(2, 4), (0, 2), (3, 2), (3, 2), (1, 3), (3, 2), (3, 3), (1, 2), (3, 4), (3, 3)]
T = int(input())
for _ in range(T):
    a = int(input())
    print(*matcha[a])